<?php


namespace App\Model;

/**
 * 用户模型类
 *  作者 薛原
 *  日期 2025/10/17
 * Class Articles
 * @package App\Model
 */
class User extends Model
{
    protected $table = 'users';
    protected $fillable = ['name','email','password','role'];

    /**
     * 与文章表关联
     * @return \Hyperf\Database\Model\Relations\HasMany
     */
    public function article()
    {
        return $this->hasMany(\App\Model\Articles::class, 'user_id', 'id');
    }

    /**
     * 与用户资料表关联
     * @return \Hyperf\Database\Model\Relations\HasOne
     */
    public function profiles()
    {
        return $this->hasOne(\App\Model\UserProfiles::class, 'user_id', 'id');
    }
}